home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / comm / 0141ter2.zip / 0141TER2._XE / PASCAL.EXE / MANUAL.PAS < prev    next >
Pascal/Delphi Source File  |  1993-06-10  |  4KB  |  132 lines

  1. Program MANUAL;    { Converts Terminate help files into the manual }
  2.  
  3. Type
  4.   BufType = Array[1..40960] of Byte;
  5.  
  6. Var
  7.   IB, OB         : ^BufType;
  8.   InFile,OutFile : Text;
  9.   S              : String;
  10.   TotalLines     : Longint;
  11.  
  12. Function NumChar(Ch : Char; Lgd : Byte): String;
  13. { Returns a string filled with a char at Lgd Lenght }
  14. Var
  15.   s : String;
  16. Begin
  17.   FillChar(S[1], Lgd, Ch);
  18.   S[0] := Char(Lgd);
  19.   NumChar:=S;
  20. End;
  21.  
  22. Function BlankAfter(Txt : String; Lgd : Byte): String;
  23. { Appends blank to a string until desired length }
  24. Begin
  25.   While Length(Txt)<Lgd Do Txt:=Txt+' ';
  26.   BlankAfter:=Txt;
  27. End;
  28.  
  29. Function SizeOfFile(Filename:string):Longint;
  30. Var
  31.   F : File;
  32. Begin
  33.   Assign(F,Filename);
  34.   {$I-} Reset(F,1); {$I+}
  35.   If IOResult=0 Then
  36.   Begin
  37.     SizeofFile:=FileSize(F);
  38.     Close(F);
  39.   End
  40.   Else SizeofFile:=-1;
  41. End;
  42.  
  43. Procedure AppendManual(Filename:string; Header:String);
  44. Var Lines:Longint;
  45. Begin
  46.   Assign(InFile,Filename);
  47.   SetTextBuf(InFile,IB^);
  48.   {$I-} Reset(InFile); {$I+}
  49.   If IOResult=0 Then
  50.   Begin
  51.     Lines:=0;
  52.     If Header<>'' Then
  53.     Begin
  54.    {   WriteLn(OutFile,' ');    }    { Page Feed #12 before each helpfile }
  55.       WriteLn(OutFile,'┌───────────────────────────────────────────────────────────────────────────┐');
  56.       WriteLn(OutFile,'│ ░░░░ '+Header+' '+Numchar('░',67-Length(Header))+' │');
  57.       WriteLn(OutFile,'└───────────────────────────────────────────────────────────────────────────┘');
  58.     End;
  59.     While Not Eof(InFile) Do
  60.     Begin
  61.       ReadLn(InFile,s);
  62.       Inc(Lines);
  63.       { removes any color codes }
  64.       While Pos('^b',s)<>0 Do Delete(s,Pos('^b',s),2);
  65.       While Pos('^n',s)<>0 Do Delete(s,Pos('^n',s),2);
  66.       While Pos('^h',s)<>0 Do Delete(s,Pos('^h',s),2);
  67.       While Pos('^t',s)<>0 Do Delete(s,Pos('^t',s),2);
  68.       While Pos('^m',s)<>0 Do Delete(s,Pos('^m',s),2);
  69.       While Pos('^r',s)<>0 Do Delete(s,Pos('^r',s),2);
  70.       While Pos('^f',s)<>0 Do Delete(s,Pos('^f',s),2);
  71.       WriteLn(OutFile,s);
  72.     End;
  73.     Close(InFile);
  74.     WriteLn('Compiled  : '+BlankAfter(Filename,13)+BlankAfter(Header,42),
  75.             Lines:4,'  ',SizeofFile(Filename):6);
  76.     Inc(TotalLines,Lines);
  77.   End
  78.   Else WriteLn('Compiling : Error opening '+Filename);
  79. End;
  80.  
  81. Begin
  82.   WriteLn(#10#13'─────────── Terminate manual file compiler made 1993 by Bo Bendtsen ───────────');
  83.  
  84.   New(IB);    { Makes large buffers at 40960 bytes each to speed up compile }
  85.   New(OB);    { time for both input and output files.                       }
  86.  
  87.   Assign(OutFile,'TERMINAT.DOC');
  88.   SetTextBuf(OutFile,OB^);
  89.   {$I-} Rewrite(OutFile); {$I+}
  90.   If IOResult=0 Then
  91.   Begin
  92.     TotalLines:=0;
  93.  
  94.     { Main help file Ctrl-Shift-F1 }
  95.     AppendManual('TERMINAT.HLP','');
  96.  
  97.     { Help files for configuration }
  98.     AppendManual('MAINCONF.HLP','Configurating Terminate');
  99.     AppendManual('SCRCOLOR.HLP','Screen and Colors');
  100.     AppendManual('COMMUNIC.HLP','Communications');
  101.     AppendManual('GENERALM.HLP','General options');
  102.     AppendManual('TOGGLESM.HLP','Toggles');
  103.     AppendManual('MODEMDIA.HLP','Modem and dialing');
  104.     AppendManual('FILEPATH.HLP','Filenames and paths');
  105.     AppendManual('PROTOCOL.HLP','Protocols');
  106.     AppendManual('EMULATIO.HLP','Emulations');
  107.     AppendManual('HOSTSETT.HLP','Host mode');
  108.     AppendManual('LOGINSCR.HLP','Auto login');
  109.     AppendManual('USERSSET.HLP','Users / IEMSI setup');
  110.     AppendManual('POINTSYS.HLP','The Pointsystem');
  111.     AppendManual('COSTMANA.HLP','Cost management');
  112.  
  113.     { Help files for other functions }
  114.     AppendManual('PHONEBOO.HLP','The Phonebook');
  115.     AppendManual('FILETAGG.HLP','File tagging and tagmenu');
  116.     AppendManual('FILEMANA.HLP','The Filemanager');
  117.     AppendManual('CDROMPLA.HLP','CD audio player');
  118.  
  119.     AppendManual('ENDOFMAN.HLP','End of manual');
  120.  
  121.     Close(OutFile);
  122.     WriteLn(Numchar('─',79));
  123.     WriteLn('TERMINAT.DOC was compiled                           Lines / bytes ',
  124.             TotalLines:5,'  ',SizeofFile('TERMINAT.DOC'):6);
  125.  
  126.   End
  127.   Else WriteLn('Could not write to TERMINAT.DOC');
  128.  
  129.   Dispose(IB);
  130.   Dispose(OB);
  131. End.
  132.